-
Notifications
You must be signed in to change notification settings - Fork 962
Add WebSocket handler for Browser and Node #9191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dl/live
Are you sure you want to change the base?
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the comments for more but I'm leaning towards not offering this for Node given the complications and not being sure there's a big demand for it anyway. I feel really bad about that given the effort you've put into the Node implementation and the clever dead code trick but it might come back.
Size Report 1Affected ProductsNo changes between base commit (a4897a6) and merge commit (a06a3a1).Test Logs |
Size Analysis Report 1Affected ProductsNo changes between base commit (a4897a6) and merge commit (a06a3a1).Test Logs |
@@ -159,6 +159,7 @@ | |||
"typescript": "5.5.4", | |||
"watch": "1.0.2", | |||
"webpack": "5.98.0", | |||
"ws": "8.18.3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're getting rid of this, right?
Edit: Oh, you need it for the server for the test.
Edit 2: Should probably leave it in the package.json for the product package if it's not used anywhere else.
* limitations under the License. | ||
*/ | ||
|
||
import { NodeWebSocketHandler } from './node/websocket'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work? The rollup alias just replaces the node
in the import path, it doesn't replace the name of the imported symbol, right? Isn't this supposed to be just WebSocketHandlerImpl
or something and the exported symbol from node/websocket.ts
and browser/websocket.ts
both have the same name?
Adds a WebSocket handler with implementations in Browser and Node environments. This will be used for BiDi.
Changes:
WebSocketHandler
:BrowserWebSocketHandler
) and Node (NodeWebSocketHandler
).NodeWebSocketHandler
uses the built-in globalWebSocket
available in Node >= 22.ws
as a dev dependency for types and the mock test server (Node 22 doesn't support web socket servers).BrowserWebSocketHandler
using a mockedwindow.WebSocket
.NodeWebSocketHandler
using a localMockWebSocketServer
.test:node
generateAliasConfig
to the set of rollup helpers, and uses it for platform import aliasing.